#pragma once
#include "TNode.h"
#include <iostream>
#include <vector>

typedef int INTEGER;
typedef int INDEX;
typedef string STRING;
typedef bool BOOLEAN;
typedef string NODETYPE;
typedef string LINKTYPE;

using namespace std;

class AST{
private:
	TNode *_root;
	INTEGER _totalLineNum;
public:
	BOOLEAN setRoot(TNode *node);
	TNode* getRoot();
	void setTotalLineNum(INTEGER num);
	INTEGER getTotalLineNum();
	TNode* getNodeFromLineNum(TNode* node,INTEGER num);
	vector<INDEX> getVarsFromLineNum(INTEGER);
	vector<INDEX> getVarsFromLineNumTool(vector<INDEX>* v,INTEGER lineNUm,TNode* node);
	TNode* createNode(NODETYPE nodeType);
	LINKTYPE createLink(TNode *fromNode, TNode *toNode, LINKTYPE linkType);
	TNode* getParent(TNode* node);
	vector<TNode*> getParentStar(TNode* node);
	vector<TNode*> getParentStarVector(vector<TNode*>* parents, TNode* node);
	TNode* getFollow(TNode* node);
	TNode* getFollowBy(TNode* node);
	vector<TNode*> getFollowStar(TNode* node);
	vector<TNode*> getFollowStarVector(vector<TNode*>* rightSiblings, TNode* node);
	vector<TNode*> getFollowByStar(TNode* node);
	vector<TNode*> getFollowByStarVector(vector<TNode*>* leftSiblings, TNode* node);
	TNode** getDirectMoreChildren(TNode* node);
	vector<TNode**> getMoreChildrenStar(TNode* node);
	vector<TNode**> getMoreChildrenStarVector(vector<TNode**>* moreChildren,TNode *node);
};